package Homework;

import java.io.*;
import java.nio.charset.StandardCharsets;

public class OOSOISDemo {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        String name = "姜可";
        int age = 66;
        String gender="男";
        String arr[]={"大家好我叫二线明星阿坤"};
       // Student jk= new Student("姜可",22,"男",{"你好我叫小帅"});
        Student jk = new Student(name,age,gender,arr);
        System.out.println(jk);

        FileOutputStream fos = new FileOutputStream("t3.txt");
        ObjectOutputStream oos=new ObjectOutputStream(fos);

        oos.writeObject(jk);
        System.out.println("赋值完毕！");
        oos.close();
        //



        FileInputStream fis = new FileInputStream("t3.txt");
        ObjectInputStream ois=new ObjectInputStream(fis);

        Object ob1=ois.readObject();

        Student jk1=(Student) ob1;
        System.out.println(jk1);
        System.out.println("读取完毕！");
        ois.close();







       // oos.writeObject("总以为，爱是全部的心跳，失去爱我们就要，".getBytes(StandardCharsets.UTF_8));
        //oos.writeObject("就要，一点点慢慢的s掉~！~~~".getBytes(StandardCharsets.UTF_8));




    }
}
